import * as Color from './color'

export const cssColorConfig = `:root {
  --main-300: ${Color.main300};
  --main-400: ${Color.main400};
  --main-500: ${Color.main500};
  --main-600: ${Color.main600};
  --main-700: ${Color.main700};

  --secondary-300: ${Color.secondary300};
  --secondary-400: ${Color.secondary400};
  --secondary-500: ${Color.secondary500};
  --secondary-600: ${Color.secondary600};
  --secondary-700: ${Color.secondary700};

  --primary-300: ${Color.primary300};
  --primary-400: ${Color.primary400};
  --primary-500: ${Color.primary500};
  --primary-600: ${Color.primary600};
  --primary-700: ${Color.primary700};

  --success-300: ${Color.success300};
  --success-400: ${Color.success400};
  --success-500: ${Color.success500};
  --success-600: ${Color.success600};
  --success-700: ${Color.success700};

  --warning-300: ${Color.warning300};
  --warning-400: ${Color.warning400};
  --warning-500: ${Color.warning500};
  --warning-600: ${Color.warning600};
  --warning-700: ${Color.warning700};

  --error-300: ${Color.error300};
  --error-400: ${Color.error400};
  --error-500: ${Color.error500};
  --error-600: ${Color.error600};
  --error-700: ${Color.error700};

  --char-300: ${Color.char300};
  --char-400: ${Color.char400};
  --char-500: ${Color.char500};
  --char-600: ${Color.char600};
  --char-700: ${Color.char700};

  --linear-main-to-secondary: linear-gradient(180deg, ${Color.main500} 0%, ${Color.secondary500} 100%)
}`

export function getTailwindColorObject(name: Color.ColorName): Record<number, string> {
  const obj: Record<number, string> = {}
  Color.colorRange.map(x => obj[x] = Color[name + x.toString()])
  return obj
}

export const tailwindColorConfig = {
  main: getTailwindColorObject('main'),
  primary: getTailwindColorObject('primary'),
  secondary: getTailwindColorObject('secondary'),
  error: getTailwindColorObject('error'),
  warning: getTailwindColorObject('warning'),
  success: getTailwindColorObject('success'),
  info: getTailwindColorObject('info'),
  char: getTailwindColorObject('char'),
}